<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
        template="layout/templateInventario.xhtml">


<ui:define name="body">

    <h:form id="invCliente" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{invClienteHome.managed ? 'Editar' : 'Agregar '} cliente </f:facet>

            <s:decorate id="cliNombreField" template="layout/edit.xhtml">
                <ui:define name="label">Cliente:</ui:define>
                <h:inputText id="cliNombre"
                       required="true"
                           size="50"
                      maxlength="50"
                      rendered="true"
                      requiredMessage="Ingrser el nombre del clientes !!!"
                          value="#{invClienteHome.instance.cliNombre}">
                    <a:support event="onblur" reRender="cliNombreField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="cliDireccionField" template="layout/edit.xhtml">
                <ui:define name="label">Direccion:</ui:define>
                <h:inputText id="cliDireccion"
                           size="30"
                      maxlength="30"
                          value="#{invClienteHome.instance.cliDireccion}">
                    <a:support event="onblur" reRender="cliDireccionField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <s:decorate id="cliTelefonoField" template="layout/edit.xhtml">
                <ui:define name="label">Telefono:</ui:define>
                <h:inputText id="cliTelefono"
                           size="9"
                      maxlength="9"
                          value="#{invClienteHome.instance.cliTelefono}">
                    <a:support event="onblur" reRender="cliTelefonoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <div style="clear:both">
                <span class="required">*</span>
                Campos requeridos
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Guardar"
                         action="#{invClienteHome.persist}"
                       disabled="#{!invClienteHome.wired}"
                       rendered="#{!invClienteHome.managed}"/>

            <h:commandButton id="update"
                          value="Actualizar"
                         action="#{invClienteHome.update}"
                       rendered="#{invClienteHome.managed}"/>

            <h:commandButton id="delete"
                          value="Eliminar"
                         action="#{invClienteHome.remove}"
                      immediate="true"
                       rendered="#{invClienteHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancelar"
             propagation="end"
                    view="/InvCliente.xhtml"
                rendered="#{invClienteHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancelar"
             propagation="end"
                    view="/#{empty invClienteFrom ? 'InvClienteList' : invClienteFrom}.xhtml"
                rendered="#{!invClienteHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">
</rich:tabPanel>
</ui:define>

</ui:composition>
